package JUC.lock;

import java.util.concurrent.TimeUnit;

/**
 * @author mubei
 * @date 2021/11/23
 * @description
 */
public class Demo01 {

    public static void main(String[] args) {
        Phone3 phone3 = new Phone3();

        new Thread(()->{
            phone3.sms();
        },"A").start();
        new Thread(()->{
            phone3.call();
        },"B").start();
    }
}

class Phone3{
    public synchronized void sms(){
        System.out.println(Thread.currentThread().getName()+"sms");
        call();
    }

    public  void call(){
        System.out.println(Thread.currentThread().getName()+"call");
    }
}
